package com.czy.tank;

import com.czy.tank.common.Dir;
import com.czy.tank.common.Group;
import com.czy.tank.config.PropertyMgr;
import com.czy.tank.config.ResourceMgr;
import com.czy.tank.game.Audio;
import com.czy.tank.game.Tank;
import com.czy.tank.game.TankFrame;

/********************************************************************
 * @brief 坦克大战程序入口
 * @version 0.1
 * @date 2022年08月30日 22:03
 * @author changziyang
 ********************************************************************/
public class Main {
    public static void main(String[] args) {
        //TankFrame tankFrame = new TankFrame();
        TankFrame tankFrame = TankFrame.getInstance();
        /*生成地方坦克*/
        for (int i = 0; i < PropertyMgr.getInstance().getInt("initTankCount"); i++) {
            tankFrame.badTanks.add(new Tank(50+ ResourceMgr.goodTank1U.getWidth()*i,50, Dir.DOWN,tankFrame, Group.BAD));
        }
        tankFrame.setVisible(true);

        /*播放背景音乐*/
        new Thread(()->new Audio("audio/war1.wav").loop()).start();

        /*循环处理画面*/
        for (;;){
            try {
                Thread.sleep(25);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            tankFrame.repaint();
        }
    }
}
